<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Processing.js test of xmlElement removeChild()</title>
	<script type="text/javascript" src="../../../processing.js"></script> 

</head>
<body>


	<script id="script" type="application/processing">
XMLElement xml;
XMLElement child;
void setup() {
  size(200, 200);
  xml = new XMLElement("<sites><site id='0' url='a'>A</site><site id='1' url='b'>B</site></sites>");
  child = new XMLElement("<site id='1' url='b'>B</site>");

  int numSites = xml.getChildCount();
  println("Number of Children before remove: " + numSites);

  println("removing "+child.getContent());
  xml.removeChild(child);

  numSites = xml.getChildCount();
  println("Number of Children after remove: " + numSites);

  println("Content:");
  for (int i = 0; i < numSites; i++) {
    XMLElement kid = xml.getChild(i);
    String site = kid.getContent();
    println(site);    
  }
}

	</script>
<h1>XMLElement Test6: removeChild()</h1>
<h3>Source</h3><pre>

XMLElement xml;
XMLElement child;
void setup() {
  size(200, 200);
  xml = new XMLElement("&lt;sites&gt;&lt;site id='0' url='a'&gt;A&lt;/site&gt;&lt;site id='1' url='b'&gt;B&lt;/site&gt;&lt;/sites&gt;");
  child = new XMLElement("&lt;site id='1' url='b'>B&lt;/site&gt;");

  int numSites = xml.getChildCount();
  println("Number of Children before remove: " + numSites);

  println("removing "+child.getContent());
  xml.removeChild(child);

  numSites = xml.getChildCount();
  println("Number of Children after remove: " + numSites);

  println("Content:");
  for (int i = 0; i < numSites; i++) {
    XMLElement kid = xml.getChild(i);
    String site = kid.getContent();
    println(site);    
  }
}
</pre>
<canvas id="display" style="width:10;height:10;"></canvas>
</body>
</html>

